package com.dl.designmodel.proxy;

/**
 * @ProjectName: mcroservices
 * @Package: com.dl.designmodel.proxy
 * @ClassName: ProxySubject
 * @Author: 86977
 * @Description: ${description}
 * @Date: 2021/6/30 16:51
 * @Version: 1.0
 */
public class ProxySubject implements Subject {
  private  RealSubject realSubject;

  public ProxySubject(RealSubject realSubject) {
    this.realSubject = realSubject;
  }

  public ProxySubject() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
    this.realSubject=(RealSubject)this.getClass().getClassLoader().loadClass("com.dl.designmodel.proxy.ProxySubject").newInstance();
  }

  @Override
  public void dosomething() {
    realSubject.dosomething();
  }

}
